﻿using MengLin.OOP.DesignPattern.Command.ControlTV.Interface;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MengLin.OOP.DesignPattern.Command.ControlTV
{
    /// <summary>
    /// 命令的发起者（遥控器）
    /// </summary>
    public class Control
    {
        private ICommand CommandOn, CommandOff, CommandChange;

        public Control(ICommand commandOn,ICommand commandOff, ICommand commandChange)
        {
            CommandOn = commandOn;
            CommandOff = commandOff;
            CommandChange = commandChange;
        }

        /// <summary>
        /// 开机
        /// </summary>
        public void TurnOn()
        {
            CommandOn.Execute();
        }

        /// <summary>
        /// 开机
        /// </summary>
        public void TurnOff()
        {
            CommandOff.Execute();
        }

        /// <summary>
        /// 改变频道
        /// </summary>
        public void ChangeChannel()
        {
            CommandChange.Execute();
        }
    }
}
